home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / devel201.zip / ST-MAIN.C < prev    next >
C/C++ Source or Header  |  1995-02-19  |  4KB  |  168 lines

  1. /**************************************************************************************************
  2.  
  3.     SPELTEST
  4.     Program to test spelling checker.
  5.  
  6.     Written and copyright by Brian J Quinion 1995.
  7.  
  8.     Version for Microsoft Windows.
  9.     Version:  0.01 (Production)
  10.     Date:     19 Feb 1995
  11.     Module:   ST-MAIN.C
  12.  
  13. **************************************************************************************************/
  14.  
  15.     /* include files common to all modules */
  16. #define EXTERN
  17.     #include "speltest.h"
  18.  
  19.     /* include files for this module only */
  20.     #pragma  hdrstop
  21.     /* NONE */
  22.  
  23. /***************************************************************************************************
  24.  
  25.     WinMain
  26.     -------
  27.     Main function for windows program
  28.  
  29.     Parameters : WinMain standard
  30.     Called by  : Windows OS
  31.     Calls      : 
  32.     Modifies   : 
  33.     Returns    : As standard
  34.  
  35. ***************************************************************************************************/
  36. #pragma argsused
  37. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  38. {
  39.     HWND            hWnd;
  40.     MSG             msg;
  41.  
  42.     if(hPrevInstance)
  43.     {
  44.     // Don't run another
  45.     return FALSE;
  46.     }
  47.  
  48.     // Make a copy of hInstance for global use
  49.     g.hInst=hInstance;
  50.  
  51.     // Get the program path
  52.     GetModuleFileName(g.hInst, g.szProgDir, MAXDIR);
  53.     *(strrchr(g.szProgDir, '\\'))='\0';
  54.  
  55.     // Load settings
  56.     LoadSettings();
  57.     LoadResources();
  58.  
  59.     // Start the main window
  60.     RegisterSPELTEST_MAIN();
  61.     hWnd=CreateWindow("SPELTEST_MAIN", "Spell Checker Tester", WS_OVERLAPPEDWINDOW, 10, 10, 400, 300,
  62.                       NULL, NULL, g.hInst, NULL);
  63.     ShowWindow(hWnd, SW_SHOW);
  64.  
  65.     // Enter the message loop
  66.     while (GetMessage(&msg, (HWND) NULL, 0, 0))
  67.     {
  68.         TranslateMessage(&msg);
  69.         DispatchMessage(&msg);
  70.     }
  71.  
  72.     // Save settings
  73.     SaveSettings();
  74.     FreeResources();
  75.  
  76.     return 0;
  77. }
  78.  
  79. /***************************************************************************************************
  80.  
  81.     LoadSettings
  82.     ------------
  83.     Load settings from the ini file and the dat file
  84.  
  85.     Parameters : none
  86.     Called by  : WinMain
  87.     Calls      : 
  88.     Modifies   :
  89.         o.SaveOptions        -
  90.     Returns    :
  91.  
  92. ***************************************************************************************************/
  93. void LoadSettings(void)
  94. {
  95. }
  96.  
  97. /***************************************************************************************************
  98.  
  99.     SaveSettings
  100.     ------------
  101.     Save settings to the ini file and the dat file
  102.  
  103.     Parameters : none
  104.     Called by  : WinMain
  105.     Calls      : 
  106.     Modifies   : ini and dat files
  107.     Returns    : nothing
  108.  
  109. ***************************************************************************************************/
  110. void SaveSettings(void)
  111. {
  112. }
  113.  
  114. /***************************************************************************************************
  115.  
  116.     LoadResources
  117.     -------------
  118.     Load resources, and initalise
  119.  
  120.     Parameters : none
  121.     Called by  : WinMain
  122.     Calls      : 
  123.     Modifies   :
  124.     Returns    :
  125.  
  126. ***************************************************************************************************/
  127. void LoadResources(void)
  128. {
  129. }
  130.  
  131. /***************************************************************************************************
  132.  
  133.     FreeResources
  134.     -------------
  135.     Free resources
  136.  
  137.     Parameters : none
  138.     Called by  : WinMain
  139.     Calls      : 
  140.     Modifies   :
  141.     Returns    :
  142.  
  143. ***************************************************************************************************/
  144. void FreeResources(void)
  145. {
  146. }
  147.  
  148. /***************************************************************************************************
  149.  
  150.     WritePrivateProfileInt
  151.     ----------------------
  152.     Suppliment function to GetPrivateProfileInt
  153.  
  154.     Parameters : 
  155.     Called by  : 
  156.     Calls      : 
  157.     Modifies   :
  158.     Returns    :
  159.  
  160. ***************************************************************************************************/
  161. BOOL WritePrivateProfileInt(LPSTR lpSection, LPSTR lpItem, DWORD Int, LPSTR lpFileName)
  162. {
  163.     char            Buffer[20];
  164.  
  165.     itoa((int)Int, Buffer, 10);
  166.     return WritePrivateProfileString(lpSection, lpItem, (LPSTR)Buffer, lpFileName);
  167. }
  168.